import ccclass = cc._decorator.ccclass;
import Collider = cc.Collider;
import GameMainEntry from "../Base/GameMainEntry";
import GameEventArgs from "../../AzraelFrameWork/src/Event/GameEventArgs";
import {EventID} from "../Event/EventID";
import {ReferencePool} from "../../AzraelFrameWork/src/Base/ReferencePool/ReferencePool";
export class ScoreGameEventArgs extends GameEventArgs{
    public static Create():ScoreGameEventArgs{
        let eventagrs:ScoreGameEventArgs = ReferencePool.Acquire(ScoreGameEventArgs);
        return  eventagrs;
    }

    Clear(): void {
    }

    Id(): number {
        return EventID.Score;
    }

}

export class HitCountGameEventArgs extends GameEventArgs{
    public static Create():HitCountGameEventArgs{
        let eventagrs:HitCountGameEventArgs = ReferencePool.Acquire(HitCountGameEventArgs);
        return  eventagrs;
    }

    Clear(): void {
    }

    Id(): number {
        return EventID.HitCount;
    }

}


export class GameOverEventArgs extends GameEventArgs{
    public static Create():GameOverEventArgs{
        let eventagrs:GameOverEventArgs = ReferencePool.Acquire(GameOverEventArgs);
        return  eventagrs;
    }
    Clear(): void {
    }

    Id(): number {
        return EventID.gameover;
    }

}


@ccclass
export  class CircleTriggerScript extends cc.Component{
    onCollisionEnter(other:Collider,self:Collider){
        if(other.node.group == "star"){
            GameMainEntry.Event.Fire(other,ScoreGameEventArgs.Create());
        }
        else if(other.node.group == "Side"){
            GameMainEntry.Event.Fire(self,GameOverEventArgs.Create());
        }
        else if(other.node.group == "line"){
            GameMainEntry.Event.Fire(self,HitCountGameEventArgs.Create());
        }
    }

    onCollisionStay(other,self){

    }

    onCollisionExit(other,self){

    }

}